#! /usr/bin/env python3

from PySide2.QtWidgets import *
from PySide2.QtCore import Signal


class CViewSpeed(QWidget):
    ValueChanged = Signal(int)

    def __init__(self, parent=None, speed=1.0):
        super(CViewSpeed, self).__init__(parent)
        self.setLayout(QHBoxLayout())
        self.sp = QSpinBox()
        self.sp.setRange(0, 16)
        self.sp.setValue(0)
        self.sp.setSingleStep(2)
        self.layout().addWidget(self.sp)
        self.sp.valueChanged.connect(lambda v: self.ValueChanged.emit(v))

    @property
    def value(self):
        self.sp.value()
